package com.dotflat.physicalevaluate.domain.importexport;

import com.dotflat.physicalevaluate.domain.pe.PERecord;
import com.dotflat.rest.domain.AreableObjectBase;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.List;

/**
 * 月龄对应的操作，对应测评表的月单元格
 */

@Data
@Entity
@Table(name = "pe_evaluate_import_record")
@EqualsAndHashCode(callSuper = false)
public class PhysicEvaluateImportRecord extends AreableObjectBase {

//    @Column(columnDefinition = " datetime DEFAULT NOW() COMMENT '创建时间' ")
//    private Date created = new Date();

    @Column(columnDefinition = "varchar(32) COMMENT '班级id' ")
    private String classId;

    @Column(columnDefinition = "varchar(32) COMMENT '班级名称' ")
    private String className;

    @Column(columnDefinition = " int(11) default 0 COMMENT '成功记录的计数器' ")
    private Integer successCount;

    @Column(columnDefinition = " int(11) default 0 COMMENT '所有条目' ")
    private Integer fullCount;

    @Column(columnDefinition = " int(11) default 0 COMMENT '测评参与成员数量，用来校验' ")
    private Integer childCount;

    @Column(columnDefinition = " varchar(500) COMMENT '上传的文件' ")
    private String importFile;

    @Column(columnDefinition = " varchar(32) COMMENT '创建老师id' ")
    private String createTeacherId;

    @Column(columnDefinition = " varchar(50) COMMENT '创建老师名称' ")
    private String createTeacherName;

    @Column(columnDefinition = " bit(1) default 0 COMMENT '是否完成' ", nullable = false)
    private Boolean finished;

    @Column(columnDefinition = "int(8) default 0 COMMENT '类型记录' ", nullable = false)
    private Integer typeHistory = 0;

    @OneToMany(mappedBy = "importRecord", cascade = CascadeType.DETACH, fetch = FetchType.EAGER)
    @OrderBy ("created asc")
    private List<PERecord> records;
}
